package com.tom.architect.day19.simple1;

import com.tom.architect.day19.simple1.iterator.Iterator;
import com.tom.architect.day19.simple1.iterator.QQIterator;

import java.util.ArrayList;
import java.util.List;

public class QQUserSystem implements Aggregate<UserInfo> {
    private List<UserInfo> userInfos;

    public QQUserSystem() {
        userInfos = new ArrayList<>();
        userInfos.add(new UserInfo("aa", "123", "1", "0"));
        userInfos.add(new UserInfo("bb", "124", "2", "1"));
        userInfos.add(new UserInfo("cc", "125", "3", "1"));
    }

    // 只暴露迭代器接口。
    @Override
    public Iterator<UserInfo> iterator() {
        return new QQIterator(userInfos);
    }
}
